Administrator Guide 2017
Concepts - Calculated-values

Calculated values are simple calculations. These can be arithmetical calculations (eg. adding the values of two other items together) but they can also be used to fill in text values and look up data entered elsewhere. Numerical calculations can be output as whole numbers, to decimals, to times or to financial values.

Allowable calculations are outlined below and you will notice the use of unique names to refer to the value of another item in the document. As you can see, the system-generated unique names have been changed to make them easier to use.

Setting up a Total Score calculated item type

Setting up a Total Score calculated item type

Associating numerical values with list items

Associating numerical values with list items

Total score

Leaving the calculation field empty prompts a “total score” type calculation. This uses the associated numeric value of a drop-down or multiple choice list (if entered in the list entry).

 

For example, a drop-down list may contain parts for a repair and the associated value may be the cost of that part.  When selected in the multiple choice list, that cost will be displayed.

Setting up an arithmetic calculated item type

Setting up an arithmetic calculated item type

Arithmetic (2 values)

Arithmetic operators "+" for addition, "-" for subtraction, "*" for multiplication and "/" for division can be used as shown below. In many cases both values will be unique names, but fixed numbers can also be used.
  • RiskWeighting * HazardValue
  • InsideScore + OutsideScore
  • OnsiteHours - 1
  • NetCost / 5

Setting up basic lookup calculated item type

Setting up basic lookup calculated item type

Lookup

This calculation is used to display a numeric result associated with another item on the form. Use @uniquename where uniquename is replaced by the actual unique name of the item whose result you wish to display.

Setting up a table lookup calculated item type

Setting up a table lookup calculated item type

Lookup (table)

When looking up values from table items, you can also use the syntax @uniquename:sum(colName) to sum the values of all colName values within the table.

Lookup header

This calculation allows you to display general form information (customer, location, date, etc) and sequence numbers. Multiple pieces of information can be displayed together, separated by "$" in the format $xxxx$yyyy$zzzz where xxxx, yyyy and zzzz can be the following.
Setting up a text calculated item type

Setting up a text calculated item type

:(followed by text)

This will display the text. When combined with lookup items below, this can be used to generate, for instance, "Call out to Bridge Farm Garage" by entering '$:Call out to $location'.

Setting up a sequence calculated item type

Setting up a sequence calculated item type

seq:

This is used to generate a sequential number using the syntax $seq:sequence name:starting number:increment. For example $seq:Order number:1000:1 tells the application to use the sequence of numbers that we’re calling ‘Order number’, start at 1000 and then add 1 on every time. The following components must be separated by colons (':').

A sequence name can be shared between forms but a sequence number calculated on a device is local to that device so there is a danger of duplication. For this reason, unique sequential numbers that are used on more than one device are more safely stored and allocated centrally on the server (see template actions). The problem can also be solved by employing a username to give a unique value such as:

CORE PRODUCT NAME%% but is useful to recognise what has been set up. It also enables different, independent sequences of numbers such as Quotation numbers and Invoice numbers.

Starting number is the initial value to use. It is often a multiple of 10 (such as 100, 1000, 100000) to facilitate string manipulation in case it is subsequently to be used as text. The device user will be asked to confirm the starting number when a sequence is first used so as to prevent a sequence from accidentally re-using previous numbers.

Increment is the amount that will be added to the last number each time. Very often this is set at 1 to provide a meaningless but unique string for identification purposes (eg document number, purchase order number) but it can be any integer.

Setting up a customer calculated item type

Setting up a customer calculated item type

Customer and report data

Static header information as follows:
  • customer – the customer name
  • location – the location name
  • address – the address of the location
  • date – the date of the form
  • timestamp – the current date in YYYYMMDD form
  • time – the current time in HH:MM form
  • user – the username of the logged on user

See Also